package com.whsxt.controller;


import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.dubbo.config.annotation.Reference;
import com.whsxt.common.CodeMsg;
import com.whsxt.common.ResultData;
import com.whsxt.domain.Bills;
import com.whsxt.domain.SearchData;
import com.whsxt.service.IBillTypeService;
import com.whsxt.service.IBillsService;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 贺炯
 * @since 2019-09-18
 */
@RestController
@RequestMapping("/sys/bills")
public class BillsController {
	
	//@Autowired
	@Reference
	IBillsService iBillsService;
	//@Autowired
	@Reference
	private IBillTypeService iBillTypeService;
	
	@RequestMapping("/list")
	public Object selectAll(@RequestParam(defaultValue = "10")String limit,@RequestParam(defaultValue = "1")String page,SearchData searchData) {
		Object selectAll = iBillsService.selectAll(limit,page,searchData);
		return selectAll;
	}
	
	
	@RequestMapping("/insert")
	public Object insertOne(Bills bills) {
		boolean flag = iBillsService.saveOrUpdate(bills);
		if(flag) {
			return new ResultData();
		}
		return new ResultData(CodeMsg.ERROR);
	}
}

